package com.school.manager.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.school.manager.domaim.LifeSchool;
import com.school.manager.entity.po.LifeSchoolPo;
import com.school.manager.entity.vo.LifeSchoolVo;
import com.school.manager.mapper.LifeSchoolMapper;
import com.school.manager.service.ILifeSchoolService;
import com.school.manager.utils.PageUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * description：生活院校业务实现类
 * date：2021/10/133:18 下午
 */

@Service
@Slf4j
public class LifeSchoolServiceImpl extends ServiceImpl<LifeSchoolMapper, LifeSchool> implements ILifeSchoolService {
	
	@Autowired
    private LifeSchoolMapper lifeSchoolMapper;
	
	@Override
	public Page<LifeSchoolVo> page(LifeSchoolPo lifeSchoolPo) {
		QueryWrapper<LifeSchool> queryWrapper = PageUtil.buildQueryWrapper(lifeSchoolPo, LifeSchool.class);
        Page<LifeSchool> page = new Page<>(lifeSchoolPo.getCurrent(), lifeSchoolPo.getSize());
        lifeSchoolMapper.selectPage(page, queryWrapper);
        return PageUtil.buildPage(page, LifeSchoolVo.class);
	}
	

}
